<?php include show_tpl('public_uheader.htm'); ?>

<div style="width:100%; height:20px; background:#E9ECF3;"></div>

<?php include show_tpl('public_usider.htm'); ?>

<div id="page-wrapper" class="gray-bg">

	<div class="row wrapper wrapper-content">
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-default">
					<div class="panel-heading">
						<div class="panel-title">
							<em class="fa fa-list"></em>
							结算记录
							<span style="margin-top:-20px;margin-bottom:20px;text-align:center;font-size:12px;color:#666">
								提交订单数：<span class="blue"><?php echo $tongji_total['count']; ?></span>&nbsp;&nbsp;&nbsp;
								通过订单数：<span class="blue"><?php echo round($tongji_get['count'],2); ?></span>&nbsp;&nbsp;&nbsp;
								提现总金额：<span class="green">¥<?php echo round($tongji_total['coin'],2); ?></span>&nbsp;&nbsp;&nbsp;
								到账总金额:<span class="green">¥<?php echo round($tongji_get['coin'],2); ?></span>&nbsp;&nbsp;&nbsp;
							</span>
						</div>
					</div>
					<div class="panel-body">
						<form method="get" class="form-inline m-b-xs" action="<?php echo url('user-log-cash');?>">
							<div class="form-group">
								<select name="status" class="form-control">
									<option value="-1">全部</option>
									<option value="待审核" <?php if($status=='待审核'){echo 'selected';} ?>>待审核</option>
									<option value="已审核" <?php if($status=='已审核'){echo 'selected';} ?>>已通过</option>
									<option value="已拒绝" <?php if($status=='已拒绝'){echo 'selected';} ?>>已拒绝</option>
								</select>
							</div>&nbsp;&nbsp;
							<div class="form-group">
								<input type="text" class="form-control" name="number" placeholder="订单号" value="<?php echo $number?>">
							</div>&nbsp;&nbsp;
							<div class="form-group">
								<div class="input-group">
									<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
									<input type="text" name="fdate" readonly="" class="form_datetime form-control" value="<?php echo $fdate;?>">
									<span class="input-group-addon">至</span>
									<input type="text" name="tdate" readonly="" class="form_datetime form-control" value="<?php echo $tdate;?>">
								</div>
							</div>&nbsp;&nbsp;
							<button type="submit" class="btn btn-primary">
								<i class="fa fa-search"></i>
								&nbsp;立即查询
							</button>
							<a class="btn btn-info" href="<?php echo url('user-log-cash').$param.'&export=1';?>">导出EXCEL</a>
						</form>
						<div class="table-responsive">
							<table class="table table-bordered text-center">
								<thead class="thead">
									<tr>
										<th>账单生成时间</th>
										<th>订单号</th>
										<th>发起金额</th>
										<th>手续费</th>
										<!--th>实付金额</th-->
										<th>账单状态</th>
										<th>收款方式</th>
                                        <th>姓名</th>
                                        <th>账号</th>
									</tr>
								</thead>
								<tbody>
                                  	<?php $cash_total = $cash_fee = 0; ?>
									<?php foreach($log as $l){ ?>
                                  	<?php $span = $l['status']=='已审核' ? '<span style="color:#27ae60">' : '<span style="color:#ea413c;">'; ?>
                                  	<?php $cash_total += $l['coin']; ?>
                                  	<?php $cash_fee += $l['fee']; ?>
									<tr>
										<td><?php echo date('Y-m-d H:i:s', $l['time']);?></td>
										<td><?php echo $l['number'];?></td>
										<td><?php echo round($l['coin'],2);?></td>
										<td><?php echo round($l['fee'],2);?></td>
										<!--td><?php echo round($l['coin']-$l['fee'],2);?></td-->
										<td><?php echo $span.$l['status'];?></span></td>
										<td><?php echo $l['bank'];?><?php if($l['is_dai']==1){echo '(代付)';} ?></td>
                                        <td><?php echo $l['name'];?></td>
										<td><?php echo $l['code'];?></td>
										
									</tr>
									<?php } ?>
          							<tr>
                                    	<td colspan="2">合计</td>
                                      	<td><?php echo $cash_total;?> 元</td>
                                      	<td><?php echo $cash_fee;?> 元</td>
                                      	<!--td><?php echo $cash_total - $cash_fee;?> 元</td-->
                                      	<td colspan="4"></td>
                                    </tr>
								</tbody>
							</table>
						</div>
						<ul class="text-center"><?php echo $pagination; ?></ul>
					</div>  
				</div>
			</div>
		</div>
	</div>
</div>

<?php include show_tpl('public_ufooter.htm'); ?>

<script>
	$('.form_datetime').datepicker();
</script>